﻿using DAL.Entity;
using Microsoft.Extensions.Logging;
using static DAL.Enum;

namespace DAL.DataProcess;

public class smSystemRunStatusDataPro : smDataProBase, ISystemRunStatusDataPro
{
    private readonly ILogger<smSystemRunStatusDataPro> _logger;

    public smSystemRunStatusDataPro(IDataAccessManager dataAccessManager, ILogger<smSystemRunStatusDataPro> logger) : base(dataAccessManager)
    {
        _logger = logger;
    }

    public List<SystemRunStatusEntity> GetSysRunStatusSetting()
    {
        smErrorCode ec = smErrorCode.sm_ec_Success;

        try
        {
            IDataAccess dataAccess = _dataAccessManager.GetDataAccess(DatabaseChildrenTypeEnum.BasicInfo);

            List<SystemRunStatusEntity> result = dataAccess.GetList<SystemRunStatusEntity>().ToList();

            return result;
        }
        catch (Exception ex)
        {
            ec = smErrorCode.dt_ec_StationManager;

            _logger.LogError($"[SystemRunStatusEntity][系统状态配置失败][{ec.ToString()}][{ex.Message}]\n[{ex}]");

            throw new CustomException(ex.Message, ex, ec, "获取系统状态配置异常");
        }
    }

   
}
